package cn.panda.edu.service.impl;

import cn.panda.edu.dao.ExamMapper;
import cn.panda.edu.model.Exam;
import cn.panda.edu.model.ExamOrder;
import cn.panda.edu.service.ExamService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ExamServiceImpl implements ExamService {

	@Resource
	private ExamMapper examMapper;
	@Override
	public void saveExamOrder(ExamOrder examOrder) {
		// TODO Auto-generated method stub
		examMapper.insertExamOrder(examOrder);
	}

	@Override
	public Exam getExamById(Integer examId) {
		// TODO Auto-generated method stub
		return examMapper.selectByPrimaryKey(examId);
	}
	@Override
	public int deleteByPrimaryKey(Integer examId) {
		// TODO Auto-generated method stub
		return examMapper.deleteByPrimaryKey(examId);
	}
	@Override
	public PageInfo<Exam> getAllExam(Integer pageIndex, Integer pageSize) {
		// TODO Auto-generated method stub
		PageHelper.startPage(pageIndex,pageSize);
		List<Exam> list=examMapper.getAllExam();
		PageInfo<Exam> pageInfo=new PageInfo<>(list);
		return pageInfo;
	}
	@Override
	public int insertSelective(Exam record) {
		// TODO Auto-generated method stub
		return examMapper.insertSelective(record);
	}

}
